<template>
  <div class="home">
    <h4 class="title">系统看板</h4>
    <ul class="Kanban">
      <li>
        <div class="left">
          <img src="@/assets/home/icon/kanban1.png" alt="" />
          <p>总学员</p>
        </div>
        <div class="right">{{ dataForm.userCount }}</div>
      </li>
      <li>
        <div class="left">
          <img src="@/assets/home/icon/kanban2.png" alt="" />
          <p>总培训班</p>
        </div>
        <div class="right">{{ dataForm.clazzCount }}</div>
      </li>
      <li>
        <div class="left">
          <img src="@/assets/home/icon/kanban3.png" alt="" />
          <p>总课程</p>
        </div>
        <div class="right">{{ dataForm.courseCount }}</div>
      </li>
      <li>
        <div class="left">
          <img src="@/assets/home/icon/kanban4.png" alt="" />
          <p>总课件</p>
        </div>
        <div class="right">{{ dataForm.coursewareCount }}</div>
      </li>
      <li>
        <div class="left">
          <img src="@/assets/home/icon/kanban5.png" alt="" />
          <p>总考试</p>
        </div>
        <div class="right">{{ dataForm.examinationCount }}</div>
      </li>
    </ul>
    <h4 class="title">快捷入口</h4>
    <ul class="quickEntry">
      <li @click="$router.push('/xy_ks_banjiguanli')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick1.png" alt="" />
            <p>创建培训班</p>
          </el-col>
          <el-col :span="14" class="right">
            快速创建培训班，支持线上和线下培训班
          </el-col>
        </el-row>
      </li>
      <li @click="$router.push('/xy_ks_urriculum')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick2.png" alt="" />
            <p>添加课程</p>
          </el-col>
          <el-col :span="14" class="right">
            添加课程课件，支持视频/图片/Office文档
          </el-col>
        </el-row>
      </li>
      <li @click="$router.push('/xy_ks_questionbank')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick3.png" alt="" />
            <p>题库管理</p>
          </el-col>
          <el-col :span="14" class="right">
            批量导入导出、设定章节、题目难易度
          </el-col>
        </el-row>
      </li>

      <li @click="$router.push('/xy_ks_examination_paper')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick4.png" alt="" />
            <p>创建考试</p>
          </el-col>
          <el-col :span="14" class="right">
            快速创建一场考试，支持多种选题方式
          </el-col>
        </el-row>
      </li>

      <li @click="$router.push('/certificatemanagement')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick5.png" alt="" />
            <p>证书管理</p>
          </el-col>
          <el-col :span="14" class="right">
            定制证书，支持规则自动发放、人工颁发
          </el-col>
        </el-row>
      </li>
      <li @click="$router.push('/notice')">
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/quick1.png" alt="" />
            <p>公示管理</p>
          </el-col>
          <el-col :span="14" class="right">
            发布日常公告、新闻提醒事项
          </el-col>
        </el-row>
      </li>
    </ul>
    <h4 class="title">待办事项</h4>
    <ul class="quickEntry">
      <li
        @click="
          $router.push({
            path: '/answer',
            query: {
              answer: true
            }
          })
        "
      >
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/wenti.png" alt="" />
            <p>问答管理</p>
          </el-col>
          <el-col :span="14" class="right">
            待回复学员问题 <span class="num"> {{ form_.answerCount }} </span> 个
          </el-col>
        </el-row>
      </li>
      <li
        @click="
          $router.push({
            path: '/orderlist',
            query: {
              orderFlag: true
            }
          })
        "
      >
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/dingdan.png" alt="" />
            <p>订单管理</p>
          </el-col>
          <el-col :span="14" class="right">
            报名待审核学员<span class="num"> {{ form_.orderCount }} </span>个
          </el-col>
        </el-row>
      </li>
      <li
        @click="
          $router.push({
            path: '/result',
            query: {
              result: true
            }
          })
        "
      >
        <el-row>
          <el-col :span="10" class="left">
            <img src="@/assets/home/icon/chengji.png" alt="" />
            <p>成绩管理</p>
          </el-col>
          <el-col :span="14" class="right">
            待审核成绩学员<span class="num"> {{ form_.scoreCount }} </span>个
          </el-col>
        </el-row>
      </li>
    </ul>
    <h4 class="title">统计总览</h4>
    <ul class="statistics">
      <li :span="8" class="col">
        <Student />
      </li>
      <li :span="8" class="col">
        <Study />
      </li>
      <li :span="8" class="col">
        <Examination />
      </li>
    </ul>
  </div>
</template>
<script>
import Student from "./components/student.vue";
import Examination from "./components/examination.vue";
import Study from "./components/study.vue";
import request from "@/utils/request";
export default {
  name: "home",
  components: {
    Student,
    Examination,
    Study
  },
  data() {
    return {
      dataForm: {},
      form_: {}
    };
  },
  created() {
    this.init();
    this.todo();
  },
  methods: {
    init() {
      request({
        url: `/api/portal/systemKanban?organizeId=${this.$store.getters.organizeId}`,
        method: "get"
      }).then(res => {
        this.dataForm = res.data;
      });
    },
    todo() {
      request({
        url: `/api/portal/systemKanban/todo?organizeId=${this.$store.getters.organizeId}`,
        method: "get"
      }).then(res => {
        this.form_ = res.data;
        // console.log(this.form_);
      });
    }
  }
};
</script>
<style scoped lang="scss">
li {
  list-style: none;
}
.home {
  background-color: #ffffff;
  padding: 25px;
  width: 100%;
  // height: 87vh;
  .title {
    padding-left: 25px;
    font-size: 20px;
    font-weight: 700;
    color: #8c88a1;
    margin-bottom: 25px;
  }
  .Kanban {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    li {
      display: flex;
      width: 305px;
      height: 130px;
      box-shadow: 1px 1px 20px 1px rgba(199, 230, 243, 0.5);
      border-radius: 10px;
      .left {
        width: 40%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        img {
          width: 40px;
          height: 40px;
          margin-bottom: 15px;
        }
        p {
          color: #8c88a1;
        }
      }
      .right {
        text-align: center;
        width: 50%;
        line-height: 130px;
        font-size: 35px;
        color: #8bbdfa;
        font-weight: 700;
      }
    }
  }
  .quickEntry {
    display: flex;
    flex-wrap: wrap;
    color: #8c88a1;
    justify-content: space-between;
    margin-bottom: 10px;
    li {
      height: 80px;
      width: 32%;
      box-shadow: 1px 1px 20px 1px rgba(199, 230, 243, 0.5);
      border-radius: 10px;
      margin-bottom: 15px;
      padding: 10px;
      cursor: pointer;
      .left {
        display: flex;
        height: 60px;
        align-items: center;
        justify-content: space-evenly;
        border-right: 1px solid #ccc;
        img {
          width: 35px;
          height: 35px;
        }
        p {
          font-size: 18px;
          font-weight: 600;
        }
      }
      .right {
        line-height: 60px;
        font-size: 14px;
        text-align: center;
        .num {
          color: red;
          font-size: 18px;
          font-weight: 700;
        }
      }
    }
  }
  .statistics {
    display: flex;
    color: #8c88a1;
    justify-content: space-between;
    .col {
      width: 32.5%;
      height: 295px;
      border-radius: 10px;
      box-shadow: 1px 1px 20px 1px rgba(199, 230, 243, 0.5);
      padding: 10px;
    }
  }
}
</style>
